
  -----------------------------
  -- zTextureTest
  -- zork - 2014
  -----------------------------

  -----------------------------
  -- VARIABLES
  -----------------------------

  local wm = GetWindowManager()
  local em = GetEventManager()
  local print = d

  local addon = ZO_Object:Subclass()

  -----------------------------
  -- FUNCTIONS
  -----------------------------

  --new func
  function addon:New()
    --local instance = ZO_Object.New(self)
    self.addonName = "zTextureTest"
    --a list to parse the addons that triggered EVENT_ADD_ON_LOADED
    self.addonList = {}
    --init
    self:Initialize()
  end

  --init func
  function addon:Initialize()
    self.control = self:CreateControl()
    self:InitializeEventManagement()
  end

  --create control func
  function addon:CreateControl()

    --main control
    local c = wm:CreateTopLevelWindow()
    c:SetDimensions(128,128)
    c:SetAnchor(CENTER,GuiRoot,CENTER,0,0)
    c:SetHidden(false)
    c:SetMovable(true)
    c:SetMouseEnabled(true)
    c:SetClampedToScreen(true)
    c:SetHandler("OnReceiveDrag", function(self) self:StartMoving() end)
    c:SetHandler("OnMouseUp", function(self) self:StopMovingOrResizing() end)

    --background
    --templates: ZO_DefaultBackdrop, ZO_ThinBackdrop, ZO_InsetBackdrop, ZO_InsetTexture, ZO_CenterlessBackdrop
    c.bg = wm:CreateControlFromVirtual(nil, c, "ZO_DefaultBackdrop")
    --alternative without using a template
    --c.bg = wm:CreateControl(nil, c, CT_BACKDROP)
    --c.bg:SetCenterColor(0, 0, 0, .5)
    --c.bg:SetEdgeColor(0, 0, 0, 0.5)
    c.bg:SetAnchorFill(c)

    --texture referencing a local media folder
    c.icon = wm:CreateControl(nil, c, CT_TEXTURE)
    c.icon:SetTexture(self.addonName.."/media/purple_shield.dds")
    c.icon:SetDimensions(64,64)
    c.icon:SetAnchor(TOPLEFT,c,TOPLEFT,0,0)

    --test icon with path to ESOUI folder
    c.icon2 = wm:CreateControl(nil, c, CT_TEXTURE)
    c.icon2:SetTexture("EsoUI/Art/Progression/stamina_points_frame.dds")
    c.icon2:SetDimensions(64,64)
    c.icon2:SetAnchor(BOTTOMRIGHT,c,BOTTOMRIGHT,0,0)

    return c

  end

  --OnAddOnLoaded event trigger func
  function addon:OnAddOnLoaded(event, name)
    self.addonList[#self.addonList] = { event = event or "unknown", name = name or "unknown"}
  end

  --OnPlayerActivated event trigger func
  function addon:OnPlayerActivated()
    print("OnPlayerActivated")
    print(self.addonList)
  end

  --init events func
  function addon:InitializeEventManagement()
    --event registering
    em:RegisterForEvent(self.addonName.."_OnAddOnLoaded", EVENT_ADD_ON_LOADED, function(...) self:OnAddOnLoaded(...) end)
    em:RegisterForEvent(self.addonName.."_OnPlayerActivated", EVENT_PLAYER_ACTIVATED, function(...) self:OnPlayerActivated(...) end)
  end

  -----------------------------
  -- CALL
  -----------------------------

  addon:New()